package lock;


public class ReentrantLock {
    private synchronized void print() {
        System.out.println(Thread.currentThread().getName());
        doAdd();
    }
    private synchronized void doAdd() {
        System.out.println(Thread.currentThread().getName());
    }
    public static void main(String[] args) {
        new Thread(
                ()->{
                    ReentrantLock synchronziedDemo = new ReentrantLock();
                    synchronziedDemo.print(); // doAdd...
                }
        ).start();
    }
}
